
#ifndef ITEM_H
#define ITEM_H

#include "Type.h"
#include "Object.h"

namespace mjc {

	class Item
	{
	public:
		enum Kind
		{
			K_NONE,
			K_CONSTANT,
			K_LOCAL,
			K_STATIC,
			K_STACK,
			K_FIELD,
			K_ELEMENT,
			K_METHOD
		};

	private:
		Kind kind;
		Type type;
		Object object;//for K_METHOD only
		int value;//for K_CONSTANT only
		int address;//for K_LOCAL, K_STATIC, K_FLD, K_METHOD only

		Item():type(Type::K_NONE), object(Object::K_VARIABLE, L"", type){};

	public:
		Item(const Object& obj);
		Item(const Object& obj, const Kind& kind);
		Item(const Item& other);
		Item& operator = (const Item& other);

		Kind& GetKind() { return kind; }
		Kind GetKind() const { return kind; }
		void SetKind(const Kind& kind) { this->kind = kind; }
		Type& GetType() { return type; }
		Type GetType() const { return type; }
		Object& GetObject() {return object; }
		Object GetObject() const {return object; }
		int& GetValue() { return value; }
		int GetValue() const { return value; }
		void SetValue(int value) { this->value = value; }
		int& GetAddress() { return address; }
		int GetAddress() const { return address; }
	};
}

#endif